<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/common/inner-header.jspf"%>
<title>班级更新</title>
</head>
<body bgcolor="#ADD8E6" >
<div style="margin-left:30%;margin-top:10% ;font-size:15px;" >

     <c:forEach items="${listUser }" var="position" varStatus="v">
     
    <form action="<%=request.getContextPath() %>/yecclass/ClassServlet?command=update&id=${position.id}" method="post" onsubmit="return validates();">
                         名　　称:<input type="text" name="name" value="${position.name }" placeholder="名称" id="name" onblur="upperCase(this ,${position.id })"/>
                         <font color="#CCCC66"><span id="nameInfo"></span></font><br><br>
            
                         关联课程:<select name="course_name" style="width:130px "> 
				<option value="全部课程">—　全部课程　—</option>
                <c:forEach items="${listcourse }" var="positions" >               
				<option name="course_name" value="${positions.course_name }"  >　${positions.course_name }　</option>
				<span id="course_nameInfo"></span>
			</c:forEach>
			    
			</select><br><br>  
                        
                             状　　态:
              <c:set var="state" value="${position.state }"></c:set>
              
	          <c:if test="${state == 1}">
	            <input type="radio" name="state" value="1" checked="checked" />启用<input type="radio" name="state" value="2"/>禁止<span id="stateInfo"></span> <br><br>
	          </c:if>
	          <c:if test="${state == 2}">
	            <input type="radio" name="state" value="1"/>启用<input type="radio" name="state" value="2" checked="checked" />禁止<span id="stateInfo"></span> <br><br>
	          </c:if>  
                             
                             备　　注:<input type="text" name="memo" value="${position.memo }" placeholder="备注" id="memo"/><span id="memoInfo"></span> <br><br><br>
　　　    <input type="submit" value="修改" onclick="return confirm('是否修改？');">
      <input type="reset" name="button" id="button" value="重置" onClick="return">
      </form>
	</c:forEach>
	
<script type="text/javascript">

         //重置功能
        function hanshu(){
           window.location.href= 'view/sys/class/class-add.jsp'  /*返回本页面*/
        }
         
        function upperCase(name, id)
      {
        	
       	var xmlhttp;
        var classname = document.getElementById("name").value;
        var id = id;
        
       	if (window.XMLHttpRequest)
       	  {// code for IE7+, Firefox, Chrome, Opera, Safari
       	  xmlhttp=new XMLHttpRequest();
       	  }
      	else
       	  {// code for IE6, IE5
       	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
       	  }
       
       	xmlhttp.onreadystatechange=function()
       	  {
       	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
       	    {
       		var print = xmlhttp.responseText
       	    document.getElementById("nameInfo").innerHTML=print;
       	    }
       	  }
       	  
       	xmlhttp.open("post","<%=request.getContextPath()%>/yecclass/ClassServlet?command=onlyclassname&name="+classname+"&id=" +id,true);
       	xmlhttp.send();
    	 
     }
     
</script>
<script src="<%=request.getContextPath() %>/static/sys/class-manager/js/class_update.js"></script>
</div>
</body>
</html>